<template>
   <div class="resource_vertically_box outer_shadows">
        <ul class="resource_vertically_list">
            <li v-for="(item,index) in resource.dataList" :key="index"
                :style="{'--delay': index*0.05+'s'}"
                @click="toDetail(item.id)">
                <img :src="item.cover" alt="" class="resource_vertically_img" >
                <p class="resource_vertically_title">{{item.title}}</p>
                <div class="resource_vertically_info">
                    <span class="resource_vertically_info_content"><img src="/public/img/detail/clock_content.png" title="发表时间" alt="">{{dayjs(item.time).format(base.dateFormat)}}</span>
                    <span class="resource_vertically_info_content"><img src="/public/img/detail/support_content.png" title="点赞" alt="">{{format.n_format(item.support)}}</span>
                </div>
                <span class="resource_vertically_visit"><img src="/public/img/hot.png" alt="">{{format.n_format(item.visit)}}</span>
            </li>
        </ul>
   </div>
</template>
<!--内容正方形盒子布局-->
<script setup>
import format from "@/config/methods/digital.js"
import dayjs from "dayjs";
import base from "@/config/constant/constant.js";
import router from "@/router/index.js";
//内容列表
const resource = defineProps({
    dataList:Array,
})

const toDetail=(id)=>{
    window.open("/#/articleDetails?id="+id,"_blank")
    window.localStorage.setItem("Current_option","1000");
}

</script>

<style scoped>
.resource_vertically_box{
    max-width: 850px;

}
.resource_vertically_list{
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4,23%);
    justify-content: space-around;
    align-items: center;
    grid-row-gap: 15px;

}
.resource_vertically_list li{
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    height: 210px;
    transition: all .3s;
    box-shadow:  0 0 3px rgba(96, 97, 98, 0.21);
    animation: resource_vertically_list_li .3s ease-in-out 0s 1 forwards;
    animation-delay: var(--delay);
    opacity: 0;
}

@keyframes resource_vertically_list_li {
    0%{
        opacity: 0;
        transform: scale(0);
    }
    100%{
        opacity: 1;
        transform: scale(1);
    }

}
.resource_vertically_list li:hover{
    transform: translateY(-5px);
    box-shadow: 0 2px 10px 3px rgba(160, 205, 250, 0.68);
}
.resource_vertically_img{
    width: 100%;
    aspect-ratio: 16/11;
    margin-bottom: 5px;
}
.resource_vertically_title{
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: auto;
}

.resource_vertically_title:hover{
    cursor: pointer;
    color: #6da6e1;
}

.resource_vertically_info{
    display: flex;
    justify-content: space-between;
}
.resource_vertically_info span{
     font-size: 14px;
}
.resource_vertically_visit{
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(96, 97, 98, 0.7);
    color: white;
    padding: 0 5px;
    font-size: 13px;
    border-radius: 3px;
}

.resource_vertically_visit img{
    width: 15px;
    height: 15px;
    vertical-align: -2px;
}
.resource_vertically_info{
    display: flex;
}
.resource_vertically_info_content img{
    width: 15px;
}
.resource_vertically_info_content{
    display: flex;
    align-items: center;
}
</style>